#! /bin/sh

name=libtiff
repology_id=tiff
version=4.7.0
revision=1
tarball_url="https://download.osgeo.org/libtiff/tiff-${version}.tar.xz"
tarball_blake2b="a5df7f3ae71821a13ff5a31db012191dd1b022b1c87fe81f90fd4b4a1349b7aa15d7b336d5fa8ac9e84edcfac5fe46214d9ea54790cb037438c6a5334980c11e"
hostdeps="gcc pkg-config"
deps="core-libs freeglut libjpeg-turbo zlib zstd xz"

prepare() {
    autotools_recursive_regen
}

configure() {
    autotools_configure \
        --without-x \
        --enable-zlib \
        --enable-zstd \
        --enable-jpeg \
        --enable-lzma \
        --disable-webp \
        --enable-cxx
}

build() {
    make -j${parallelism}
}

package() {
    DESTDIR="${dest_dir}" make install

    # Move documentation to the correct location
    mv ${dest_dir}${prefix}/share/doc/tiff-${version} ${dest_dir}${prefix}/share/doc/tiff

    post_package_strip
}
